package com.ruoyi.system.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.SysWechatBind;
import com.ruoyi.system.mapper.SysWechatBindMapper;
import com.ruoyi.system.service.ISysWechatBindService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 用户微信绑定Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-10
 */
@Service
public class SysWechatBindServiceImpl implements ISysWechatBindService
{
    @Autowired
    private SysWechatBindMapper sysWechatBindMapper;

    /**
     * 查询用户微信绑定
     * 
     * @param id 用户微信绑定主键
     * @return 用户微信绑定
     */
    @Override
    public SysWechatBind selectSysWechatBindById(Long id)
    {
        return sysWechatBindMapper.selectSysWechatBindById(id);
    }

    /**
     * 查询用户微信绑定列表
     * 
     * @param sysWechatBind 用户微信绑定
     * @return 用户微信绑定
     */
    @Override
    public List<SysWechatBind> selectSysWechatBindList(SysWechatBind sysWechatBind)
    {
        return sysWechatBindMapper.selectSysWechatBindList(sysWechatBind);
    }

    /**
     * 新增用户微信绑定
     * 
     * @param sysWechatBind 用户微信绑定
     * @return 结果
     */
    @Override
    public int insertSysWechatBind(SysWechatBind sysWechatBind)
    {
        sysWechatBind.setCreateTime(DateUtils.getNowDate());
        return sysWechatBindMapper.insertSysWechatBind(sysWechatBind);
    }

    /**
     * 修改用户微信绑定
     * 
     * @param sysWechatBind 用户微信绑定
     * @return 结果
     */
    @Override
    public int updateSysWechatBind(SysWechatBind sysWechatBind)
    {
        sysWechatBind.setUpdateTime(DateUtils.getNowDate());
        return sysWechatBindMapper.updateSysWechatBind(sysWechatBind);
    }

    /**
     * 批量删除用户微信绑定
     * 
     * @param ids 需要删除的用户微信绑定主键
     * @return 结果
     */
    @Override
    public int deleteSysWechatBindByIds(Long[] ids)
    {
        return sysWechatBindMapper.deleteSysWechatBindByIds(ids);
    }

    /**
     * 删除用户微信绑定信息
     * 
     * @param id 用户微信绑定主键
     * @return 结果
     */
    @Override
    public int deleteSysWechatBindById(Long id)
    {
        return sysWechatBindMapper.deleteSysWechatBindById(id);
    }

    /**
     * 根据用户ID删除微信绑定记录
     * 
     * @param userId 用户ID
     * @return 结果
     */
    @Override
    public int deleteSysWechatBindByUserId(String userId)
    {
        return sysWechatBindMapper.deleteSysWechatBindByUserId(userId);
    }
}
